package com.cys.model.service.impl;

import com.cys.entity.Goods;
import com.cys.model.mapper.GoodsMapper;
import com.cys.model.service.IGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cys.utils.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品表 服务实现类
 * </p>
 *
 * @author cys
 * @since 2024-12-05
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {

    @Autowired
    GoodsMapper goodsMapper;

    @Override
    public ResultData insert(Goods goods) {
        ResultData resultData = new ResultData();
        int insert = goodsMapper.insert(goods);
        if (insert>0){
            resultData.setCode("200");
            resultData.setMsg(true);
            resultData.setData(null);
        }else {
            resultData.setCode("200");
            resultData.setMsg(true);
            resultData.setData(null);
        }
        return resultData;
    }

    @Override
    public List<Goods> List() {
        return goodsMapper.selectAll();

    }


}
